<%@page pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="UTF-8">
  <head>
    <%@include file="/WEB-INF/jsp/common/head.jsp" %>
	<link rel="stylesheet" href="${APP_PATH}/css/login.css">
	<style>

	</style>
  </head>
  <body>
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <div><a class="navbar-brand" style="font-size:32px;" href="#">游戏运营平台</a></div>
        </div>
      </div>
    </nav>

    <div class="container">

      <form class="form-signin" role="form">
        <h2 class="form-signin-heading"><i class="glyphicon glyphicon-user"></i> 账号</h2>
		  <div class="form-group has-success has-feedback">
			<input type="text" class="form-control" id="floginacct" name="loginacct" value="" placeholder="请输入登录账号" autofocus autocomplete="off">
			<span class="glyphicon glyphicon-ok form-control-feedback"></span>
		  </div>
		  <div class="form-group has-success has-feedback">
			<input type="password" class="form-control" id="fuserpswd" name="userpswd" value="" placeholder="请输入登录密码" style="margin-top:10px;">
			<span class="glyphicon glyphicon-lock form-control-feedback"></span>
		  </div>
		  <div class="form-group has-success has-feedback">
			<input  type="text" style="height: 40px;width: 170px;" id="fyzm" name="yzm" placeholder="请输入验证码"/>
			<img alt="" src="code.jpg" style="float: right; margin-right: 15px;width: 100px;height: 40px;" id="imgCode">
		  </div>
        <div class="checkbox">
          <label>
            <input type="checkbox" id="frememberme" name="rememberme" value="1"> 记住密码
          </label>
        </div>
        <a id="loginBtn" class="btn btn-lg btn-success btn-block" ><i class="glyphicon glyphicon-log-in"></i> 登录</a>
      </form>
    </div>
    <%@include file="/WEB-INF/jsp/common/script.jsp" %>
    <script src="${APP_PATH}/script/docs.min.js"></script>
    <script src="${APP_PATH}/js/layer/layer.js"></script>
    <script type="text/javascript">
    $("#loginBtn").click(function(){
		//alert("test");
    	var floginacct = $("#floginacct");
    	if ( floginacct.val() == "" ) {
    		layer.msg("登陆账号不能为空，请输入", {time:2000, icon:5, shift:6}, function(){
    			floginacct.focus();
    		});
    		return;
    	}
    	
    	var fuserpswd = $("#fuserpswd");
    	if ( fuserpswd.val() == "" ) {
    		layer.msg("登陆密码不能为空，请输入", {time:2000, icon:5, shift:6}, function(){
    			fuserpswd.focus();
    		});
    		return;
    	}
    	
    	var fyzm =$("#fyzm");
    	if(fyzm.val()==""){
    		layer.msg("验证码不能为空，请输入", {time:2000, icon:5, shift:6}, function(){
    			fyzm.focus();
    		});
    		return;
    	}
    	
    	var flg = $("#frememberme")[0].checked;
    
    	$.ajax({
    		url : "${APP_PATH}/manager/dologin.do",
    		type : "POST",
    		data : {
    			"loginacct" : floginacct.val(),
    			"userpswd" : fuserpswd.val(),
    			"rememberme" : flg?"1":"0",
    			"yzm":fyzm.val()
    		},
    		success : function(r) {
    			if ( r.success ) {
    					window.location.href = "${APP_PATH}/main.htm";
    			} else {
    				
    				layer.msg("信息输入有错，请重新输入！", {time:2000, icon:5, shift:6}, function(){
    					floginacct.focus();
    	    		});
    	    		return;
    			}
    		}
    	});
    });
  //给验证码绑定单击事件
	$("#imgCode").click(function(){
		//当img标签中的src属性值发生变化时，浏览器就会重新向该地址发送请求
		$(this).attr("src","code.jpg?t="+Math.random());
		//alert("hahaha");
	});
    </script>
  </body>
</html>